#!/usr/bin/python

import sys
import dbus

if (len(sys.argv) != 2):
	print "Usage: %s <timezone>" % (sys.argv[0])
	sys.exit(1)

bus = dbus.SystemBus()

clock = dbus.Interface(bus.get_object('net.connman', '/'),
					'net.connman.Clock')

print "Setting timezone to %s" % (sys.argv[1])

try:
	clock.SetProperty("Timezone", dbus.String(sys.argv[1], variant_level=1),
			  signature=dbus.Signature('sv'))
except dbus.exceptions.DBusException, e_msg:
	print e_msg
